import 'package:library_base/entities/generated/json/base/json_convert_content.dart';
import 'package:library_base/entities/goods_child_entity.dart';
import 'package:library_base/entities/goods_child_info_entity.dart';

GoodsChildEntity $GoodsChildEntityFromJson(Map<String, dynamic> json) {
  final GoodsChildEntity loginBeanEntity = GoodsChildEntity();

  final List<GoodsChildInfoEntity> goodsDetails =
      jsonConvert.convertList<GoodsChildInfoEntity>(json['goodsDetails']);
  loginBeanEntity.goodsDetails = goodsDetails;

  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    loginBeanEntity.id = id;
  }
  final String? barRules = jsonConvert.convert<String>(json['barRules']);
  if (barRules != null) {
    loginBeanEntity.barRules = barRules;
  }
  final String? goodsCode = jsonConvert.convert<String>(json['goodsCode']);
  if (goodsCode != null) {
    loginBeanEntity.goodsCode = goodsCode;
  }
  final String? goodsName = jsonConvert.convert<String>(json['goodsName']);
  if (goodsName != null) {
    loginBeanEntity.goodsName = goodsName;
  }
  final String? skuName = jsonConvert.convert<String>(json['skuName']);
  if (skuName != null) {
    loginBeanEntity.skuName = skuName;
  }
  final double? standardWeight = jsonConvert.convert<double>(json['standardWeight']);
  if (standardWeight != null) {
    loginBeanEntity.standardWeight = standardWeight;
  }
  final String? pricingMode = jsonConvert.convert<String>(json['pricingMode']);
  if (pricingMode != null) {
    loginBeanEntity.pricingMode = pricingMode;
  }
  final String? vulgo = jsonConvert.convert<String>(json['vulgo']);
  if (vulgo != null) {
    loginBeanEntity.vulgo = vulgo;
  }
  final String? shipperName = jsonConvert.convert<String>(json['shipperName']);
  if (shipperName != null) {
    loginBeanEntity.shipperName = shipperName;
  }
  final String? unit = jsonConvert.convert<String>(json['unit']);
  if (unit != null) {
    loginBeanEntity.unit = unit;
  }
  final String? materialFlag = jsonConvert.convert<String>(json['materialFlag']);
  loginBeanEntity.materialFlag = materialFlag;

  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    loginBeanEntity.createTime = createTime;
  }
  final String? updateTime = jsonConvert.convert<String>(json['updateTime']);
  if (updateTime != null) {
    loginBeanEntity.updateTime = updateTime;
  }

  final double? totalCount = jsonConvert.convert<double>(json['totalCount']);
  if (totalCount != null) {
    loginBeanEntity.totalCount = totalCount;
  }

  final double? price = jsonConvert.convert<double>(json['price']);
  if (totalCount != null) {
    loginBeanEntity.price = price;
  }

  final bool? singleEntry = jsonConvert.convert<bool>(json['singleEntry']);
  loginBeanEntity.singleEntry = singleEntry ?? false;

  final double? totalWeight = jsonConvert.convert<double>(json['totalWeight']);
  if (totalCount != null) {
    loginBeanEntity.totalWeight = totalWeight;
  }

  final double? serviceCost = jsonConvert.convert<double>(json['serviceCost']);
  if (totalCount != null) {
    loginBeanEntity.serviceCost = serviceCost;
  }

  final bool? isSelect = jsonConvert.convert<bool>(json['isSelect']);
  if (isSelect != null) {
    loginBeanEntity.isSelect = isSelect;
  }

  final bool? isExpand = jsonConvert.convert<bool>(json['isExpand']);
  if (isExpand != null) {
    loginBeanEntity.isExpand = isExpand;
  }

  return loginBeanEntity;
}

Map<String, dynamic> $GoodsChildEntityToJson(GoodsChildEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};

  data['goodsDetails'] = entity.goodsDetails;

  data['id'] = entity.id;
  data['barRules'] = entity.barRules;
  data['goodsCode'] = entity.goodsCode;
  data['goodsName'] = entity.goodsName;
  data['skuName'] = entity.skuName;
  data['standardWeight'] = entity.standardWeight;
  data['pricingMode'] = entity.pricingMode;
  data['vulgo'] = entity.vulgo;
  data['shipperName'] = entity.shipperName;
  data['unit'] = entity.unit;
  data['materialFlag'] = entity.materialFlag;
  data['createTime'] = entity.createTime;
  data['updateTime'] = entity.updateTime;

  data['totalCount'] = entity.totalCount;
  data['price'] = entity.price;
  data['totalWeight'] = entity.totalWeight;
  data['serviceCost'] = entity.serviceCost;
  data['isSelect'] = entity.isSelect;
  data['isExpand'] = entity.isExpand;
  data['singleEntry'] = entity.singleEntry;

  return data;
}
